﻿package com.starz.games.scenes {
	import com.eaglesandcobras.games.scenes.*;
	import flash.events.*;
	import flash.display.MovieClip;
	
	public class GamePlay extends PlayPage{
		private var _level:MovieClip;
		
		public function GamePlay() {
			super();
		}
		
		override public function init():void {
			addLevel();
			addTimer();
			content.continueBtn.buttonMode = true;
			content.continueBtn.addEventListener (MouseEvent.CLICK, btnClicked);
			
			copyUpdater ( "Hello World", "footer" );
		}
		
		/********************
		Add Level
		********************/
		private function addLevel():void {
			_level = createFromString ( params.level );
			addChildAt(_level,0);
		}
		
		/********************
		BUTTON CLICKED
		********************/
		private function btnClicked(e:MouseEvent):void {
			copyUpdater ( "", "footer" );
			stopTimer();
			addScore(100);
			winLevel();
		}
		
		/********************
		TIMER TO LOSE GAME
		********************/
		private function addTimer():void {
			createTimer( params.time );
			startTimer(loseLevel);
		}
	}
	
}
